import { request } from "umi"

// 用户访客
export function getviewList(page: number = 1) {
    let params = {
        page,
        pageSize: 12,
    }
    return request('/api/view', {
        params
    })
}
// 删除访客
export function delview(id: string) {
    return request(`/api/view/${id}`, {
        method: "DELETE"
    })
}
// 查询访客
export function searview(
    ip: string,
    address: string,
    browser: string,
    device: string,
    engine: string,
    os: string,
    url: string,
    userAgent: string,
    page: number = 1
) {
    let params = {
        page,
        pageSize: 12,
        ip,
        address,
        browser,
        device,
        engine,
        os,
        url,
        userAgent,
    }
    return request('/api/view', {
        params
    })
}
// 文件管理
export function getFileList(page: number = 1) {
    let params = {
        page,
        pageSize: 12,
    }
    return request('/api/file', {
        params
    })
}
//文件详情
export function getFileEdit(id: string) {
    return request(`/api/file/${id}`)
}
//文件删除
export function delFileEdit(id: string) {
    return request(`/api/file/${id}`, {
        method: "DELETE"
    })
}
// 文件查询
export function searFile(originalname: string, type: string, page: number = 1) {
    let params = {
        page,
        pageSize: 12,
        originalname,
        type
    }
    return request('/api/file', {
        params
    })
}
